package com.relax.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.HttpHeaders;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.UriUtils;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

@RestController
public class FwController {

    public static Map<String,Integer> map = new HashMap<>();
    public static Map<String,Integer> statusMap = new HashMap<>();


    /**
     * 文件下载
     * @param body
     * @return
     */
    @PostMapping("/v1.0/rest/")
    public JSONObject down(@RequestBody String body) {// @RequestBody String body
        JSONObject head = new JSONObject();
        head.put("error_code",0);
        head.put("error_string","is ok");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("head",head);
        return jsonObject;
    }

    @PostMapping("/v1.0/login")
    public JSONObject login(@RequestBody String body) {// @RequestBody String body

        JSONObject result = new JSONObject();
        result.put("token","token_5c13026ca59c");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("result",result);//success
        jsonObject.put("success",true);//success
        return jsonObject;
    }







}
